﻿@{
    ViewBag.Title = "Details";
    Layout = "~/Views/Shared/_Form.cshtml";
}
<!--框架必需start-->
<script src="~/Content/Scripts/jquery/jquery-1.10.2.min.js"></script>
<link href="~/Content/styles/font-awesome.min.css" rel="stylesheet" />
@*<script src="~/Content/Scripts/utils/LeSoft-ui.js"></script>*@
@System.Web.Optimization.Styles.Render("~/Content/styles/LeSoft-ui.css")
@System.Web.Optimization.Scripts.Render("~/Content/scripts/utils/js")
<link href="~/Content/scripts/plugins/simditor/css/simditor.css" rel="stylesheet" />
<script src="~/Content/scripts/plugins/simditor/js/module.min.js"></script>
<script src="~/Content/scripts/plugins/simditor/js/uploader.min.js"></script>
<script src="~/Content/scripts/plugins/simditor/js/hotkeys.min.js"></script>
<script src="~/Content/scripts/plugins/simditor/js/simditor.min.js"></script>
<!--框架必需end-->
<!--第三方统计图start-->
<script src="~/Content/Scripts/plugins/highcharts/highcharts.js"></script>
<script src="~/Content/Scripts/plugins/highcharts/highcharts-more.js"></script>
<script src="~/Content/Scripts/plugins/highcharts/modules/exporting.js"></script>
<!--第三方统计图end-->

<script>
    var keyValue = request('keyValue');
    var Type = request('Type');
    $(function () {
        switch (Type) {
            case "1": initControlTask(); break;
            case "2": initControlNotices(); break;
            case "3": initContainer(); break;
            default:
                dialogClose(); break;
        }
    })
    //初始化控件
    function initControlNotices() {
        $("#Notices").removeAttr("hidden");
        editor = new Simditor({
            textarea: $('#NewsContent'),
            placeholder: '这里输入公告内容...'
            //toolbar: ['title', 'bold', 'italic', 'underline', 'strikethrough', 'color', '|', 'ol', 'ul', 'blockquote', 'code', 'table', '|', 'link', 'image', 'hr', '|', 'indent', 'outdent']
        });
        //公告类别
        $("#Category").ComboBox({
            param: { EnCode: "NoticeType" },
            url: "../../SystemManage/DataItemDetail/GetDataItemListJson",
            description: "==请选择==",
            id: "ItemValue",
            text: "ItemName",
            height: "230px"
        });
        //获取表单
        if (!!keyValue) {
            $.SetForm({
                url: "../../PublicInfoManage/Notices/GetFormJson",
                param: { keyValue: keyValue },
                success: function (data) {
                    $("#txtNews").html(data.NewsContent);
                    $("#form1").SetWebControls(data);
                    editor.setValue(data.NewsContent);
                    $("#FullHead").attr("color", data.FullHeadColor).css("color", data.FullHeadColor);
                }
            });
        }
        $("td .form-control").attr("readonly", "readonly");
        $("td div").attr("disabled", "disabled");
    }

    function initControlTask() {
        $("#Task").removeAttr("hidden");
        //获取表单
        if (!!keyValue) {
            $.SetForm({
                url: "../../SystemManage/Task/GetEntity",
                param: { keyValue: keyValue },
                success: function (data) {
                    $("#form1").SetWebControls(data);
                }
            });
        }
        $("td .form-control").attr("readonly", "readonly");
        $("td div").attr("disabled", "disabled");
    }

    function initContainer() {
        $("#container").removeAttr("hidden");
        $('#container').highcharts({
            chart: {
                type: 'spline'
            },
            title: {
                text: ''
            },
            xAxis: {
                categories: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
            },
            yAxis: {
                title: {
                    text: '电量（度）'
                },
                labels: {
                    formatter: function () {
                        return this.value + '度'
                    }
                }
            },
            exporting: {
                enabled: false
            },
            credits: {
                enabled: false
            },
            tooltip: {
                crosshairs: true,
                shared: true
            },
            plotOptions: {
                spline: {
                    marker: {
                        radius: 4,
                        lineColor: '#666666',
                        lineWidth: 1
                    }
                }
            },
            series: [{
                name: '预算',
                marker: {
                    symbol: 'square'
                },
                data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 23.3, 18.3, 13.9, 9.6, 1]

            }, {
                name: '实际',
                marker: {
                    symbol: 'diamond'
                },
                data: [3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8]
            }]
        });
    }

    //保存表单
    function AcceptClick() {
        dialogClose();
    }
</script>
<div style="margin-top: 20px; margin-right: 30px;" id="Notices" hidden="hidden">
    <table class="form" style="table-layout: auto;">
        <tr>
            <td class="formTitle">公告标题</td>
            <td class="formValue" colspan="3">
                <input id="FullHead" type="text" class="form-control" />
            </td>
        </tr>
        <tr>
            <td class="formTitle">公告类别</td>
            <td class="formValue">
                <div id="Category" type="select" class="ui-select"></div>
            </td>
            <td class="formTitle">发布时间</td>
            <td class="formValue">
                <input id="ReleaseTime" readonly type="text" class="form-control" />
            </td>
        </tr>
        <tr>
            <td class="formTitle">有效期限</td>
            <td class="formValue">
                <input id="EXPTime" readonly type="text" class="form-control input-wdatepicker" onfocus="WdatePicker({ dateFmt: 'yyyy-MM-dd HH:mm:ss' })" />
            </td>
        </tr>
        @*<tr>
            <td class="formTitle">信息来源</td>
            <td class="formValue">
                <input id="SourceName" type="text" class="form-control" />
            </td>
            <td class="formTitle">来源地址</td>
            <td class="formValue">
                <input id="SourceAddress" type="text" class="form-control" />
            </td>
        </tr>*@
        <tr>
            <th class="formTitle" valign="top" style="padding-top: 4px;">公告内容</th>
            <td class="formValue" colspan="3">
                <textarea id="NewsContent" readonly class="form-control" rows="20"></textarea>
                @*<div id="txtNews" hidden="hidden"></div>*@
            </td>
        </tr>
    </table>
</div>

<div style="margin-top: 20px; margin-right: 30px;" id="Task" hidden="hidden">
    <table class="form" style="table-layout: auto;">
        <tr>
            <td class="formTitle">任务类型</td>
            <td class="formValue">
                <input id="Type" type="text" class="form-control" />
            </td>
        </tr>
        <tr>
            <td class="formTitle">发布人</td>
            <td class="formValue">
                <input id="SendMan" type="text" class="form-control" />
            </td>
        </tr>
        <tr>
            <td class="formTitle">发布时间</td>
            <td class="formValue">
                <input id="SendDate" readonly type="text" class="form-control" />
            </td>
        </tr>
        <tr>
            <th class="formTitle" valign="top" style="padding-top: 4px;">任务内容</th>
            <td class="formValue" colspan="3">
                <textarea id="TaskContent" readonly class="form-control" rows="20"></textarea>
            </td>
        </tr>
    </table>
</div>

<div hidden="hidden" style="margin-top:40px; margin-right: 30px;" id="container"></div>
